Web page presentation - Plot created with Plotly

Leena Sonpethkar

January 31, 2021

R Markdown Presentation & Plotly

Instructions

Review criteria

The rubric contains the following two questions:

Submission

library(plotly)
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(ggplot2)
library(tidyr)


data(diamonds)

dfDiamond <- diamonds %>%
              group_by(cut, color) %>%
              summarise(price = sum(price))

Sys.setenv("plotly_username"="leena-sonpethkar")
Sys.setenv("plotly_api_key"="OAPcWxwCLiUGNyeYvwGY")

pl <- plot_ly(dfDiamond, x = ~color, y = ~price, color = ~cut, type="bar") %>% 
      layout(title = "Diamond price based on Cut by Colors", xaxis=list(title="Cut"), yaxis=list(title="Price"))

pl

Thanks